<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>HtmlParser (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>

  <script type="text/javascript" src="//www.google.com/jsapi"></script>
  <script type="text/javascript">
     google.load("visualization", "1", {packages:["orgchart"]});
     var _loadingVisualizations = true;
  </script>

  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
        <span class="fn">string.html.HtmlParser</span>
        <span>Extends</span>
        <span class="fn-name">
          
        </span>
</div>

<div class="g-section g-tpl-75-25">
  <div class="g-unit g-first" id="description">
    An Html parser: <code> parse</code> takes a string and calls methods on
<code> goog.string.html.HtmlSaxHandler</code> while it is visiting it.


  </div>


        <div class="g-unit" id="useful-links">
          <div class="title">Useful links</div>
          <ol>
            <li><a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html"><span class='source-code-link'>Source Code</span></a></li>
            <li><a href="http://code.google.com/p/closure-library/source/browse/local/third_party/closure/goog/caja/string/html/htmlparser.js">Git</a></li>
          </ol>
        </div>
</div>






<h2 class="g-first">Inheritance</h2>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
  <tr><td>goog.string.html.HtmlParser</td><td></td></tr>
</table>
</div>
<div class='gviz-org-chart-container goog-inline-block'>
<table class='gviz-org-chart' style='display:none'>
</table>
</div>




  <h2>Constructor</h2>
      <div class="fn-constructor">
    goog.string.html.HtmlParser(<span></span>)
  </div>



<h2>Instance Methods</h2>


  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>







<div>
       <div class="desc">
         Defined in
         <span class="fn-name">
            <a href="class_goog_string_html_HtmlParser.html">
              goog.string.html.HtmlParser
            </a>
         </span>
       </div>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.string.html.HtmlParser.prototype.lookupEntity_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">lookupEntity_<span class="args">(<span class="arg">name</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Decodes an HTML entity.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">name</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The content between the '&amp;' and the ';'.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            A single unicode code-point as a string.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line478">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.string.html.HtmlParser.prototype.normalizeRCData_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">normalizeRCData_<span class="args">(<span class="arg">rcdata</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Escape entities in RCDATA that can be escaped without changing the meaning.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">rcdata</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The RCDATA string we want to normalize.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            A normalized version of RCDATA.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line529">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.string.html.HtmlParser.prototype.parse"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">parse<span class="args">(<span class="arg">handler</span>,&nbsp;<span class="arg">htmlText</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Given a SAX-like <code> goog.string.html.HtmlSaxHandler</code> parses a
<code> htmlText</code> and lets the <code> handler</code> know the structure while
visiting the nodes.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">handler</span>
        : <span class="type"><a href="class_goog_string_html_HtmlSaxHandler.html">goog.string.html.HtmlSaxHandler</a></span>
        <div class="entryOverview">The HtmlSaxHandler that will
    receive the events.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">htmlText</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The html text.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line361">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.string.html.HtmlParser.prototype.stripNULs_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">stripNULs_<span class="args">(<span class="arg">s</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Removes null characters on the string.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">s</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The string to have the null characters removed.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            A string without null characters.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line502">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.string.html.HtmlParser.prototype.unescapeEntities_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryName">unescapeEntities_<span class="args">(<span class="arg">s</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       The plain text of a chunk of HTML CDATA which possibly containing.

TODO(goto): use <code> goog.string.unescapeEntities</code> instead ?

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">s</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">A chunk of HTML CDATA.  It must not start or end inside
  an HTML entity.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            The unescaped entities.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line516">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
</div>




















<div class="section">
  <table class="horiz-rule">


  </table>
</div>



<h2>Static Properties</h2>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.AMP_RE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">AMP_RE_</span>
        : 
     </div>


     <div class="entryOverview">
       Regular expression that matches &amp;s.

     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line214">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.DECIMAL_ESCAPE_RE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">DECIMAL_ESCAPE_RE_</span>
        : 
     </div>


     <div class="entryOverview">
       Regular expression that matches decimal numbers.

     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line279">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.ENTITY_RE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">ENTITY_RE_</span>
        : 
     </div>


     <div class="entryOverview">
       Regular expression that matches entities.

     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line271">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.EQUALS_RE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">EQUALS_RE_</span>
        : 
     </div>


     <div class="entryOverview">
       Regular expression that matches =.

     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line255">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.Elements"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">Elements</span>
        : 
     </div>


     <div class="entryOverview">
       A map of element to a bitmap of flags it has, used internally on the parser.

     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line95">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.GT_RE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">GT_RE_</span>
        : 
     </div>


     <div class="entryOverview">
       Regular expression that matches &gt;.

     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line239">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.HEX_ESCAPE_RE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">HEX_ESCAPE_RE_</span>
        : 
     </div>


     <div class="entryOverview">
       Regular expression that matches hexadecimal numbers.

     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line287">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.INSIDE_TAG_TOKEN_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">INSIDE_TAG_TOKEN_</span>
        : 
     </div>


     <div class="entryOverview">
       Regular expression that matches the next token to be processed.

     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line295">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.LOOSE_AMP_RE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">LOOSE_AMP_RE_</span>
        : 
     </div>


     <div class="entryOverview">
       Regular expression that matches loose &amp;s.

     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line222">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.LT_RE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">LT_RE_</span>
        : 
     </div>


     <div class="entryOverview">
       Regular expression that matches &lt;.

     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line231">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.NULL_RE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">NULL_RE_</span>
        : 
     </div>


     <div class="entryOverview">
       Regular expression that matches null characters.

     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line263">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.OUTSIDE_TAG_TOKEN_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">OUTSIDE_TAG_TOKEN_</span>
        : 
     </div>


     <div class="entryOverview">
       Regular expression that matches the next token to be processed when we are
outside a tag.

     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line337">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.QUOTE_RE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">QUOTE_RE_</span>
        : 
     </div>


     <div class="entryOverview">
       Regular expression that matches ".

     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line247">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>



<h2>Enumerations</h2>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.EFlags"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">EFlags</span>
        : 
     </div>


     <div class="entryOverview">
       The html eflags, used internally on the parser.

     </div>

     <div class="entryDetails">
       <div class="detailsSection">
          <b>Constants:</b>
          <table class="horiz-rule">
            <tbody>
              <tr><td>
                <span class="entryName">
                  CDATA
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  EMPTY
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  FOLDABLE
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  OPTIONAL_ENDTAG
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  RCDATA
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  UNSAFE
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
           </tbody>
         </table>
       </div>
     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line81">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>





  <a name="goog.string.html.HtmlParser.Entities"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.string.html.HtmlParser.</span><span class="entryName">Entities</span>
        : 
     </div>


     <div class="entryOverview">
       HTML entities that are encoded/decoded.
TODO(user): use <code> goog.string.htmlEncode</code> instead.

     </div>

     <div class="entryDetails">
       <div class="detailsSection">
          <b>Constants:</b>
          <table class="horiz-rule">
            <tbody>
           </tbody>
         </table>
       </div>
     </div>

  </td>


  <td class="view-code">
     <a href="local_third_party_closure_goog_caja_string_html_htmlparser.js.source.html#line67">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Package string.html</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">Package Reference</h2>
            <div id="sideTypeIndex" rootPath="" current="string.html.HtmlParser"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
